"""
个人资料主页
"""

from selenium.webdriver.common.by import By
from pages.base_page import BasePage
class DataHomePage(BasePage):
    #定位器
    url = '/crm/index.php?m=user&a=edit'
    man_locator = (By.XPATH, '/html/body/div[5]/div[2]/div[2]/form/table/tbody/tr[10]/td[2]/input[1]')
    woman_locator = (By.XPATH, '/html/body/div[5]/div[2]/div[2]/form/table/tbody/tr[10]/td[2]/input[2]')
    phone_locator = (By.NAME, 'telephone')
    btn_ok_locator = (By.XPATH, '/html/body/div[5]/div[2]/div[2]/form/table/tfoot/tr/td[2]/input[1]')
    amend_locator = (By.XPATH,'/html/body/div[5]/div[2]/div[1]/div')

    #点击男性
    def btn_man(self):
        self.driver.find_element(*self.man_locator).click()

    #点击女性
    def btn_woman(self):
        self.driver.find_element(*self.woman_locator).click()

    #清除电话
    def clear_phone(self):
        self.driver.find_element(*self.phone_locator).clear()
    #输入电话
    def input_phone(self,phone):
        self.driver.find_element(*self.phone_locator).send_keys(phone)
    #点击保存
    def but_ok(self):
        self.driver.find_element(*self.btn_ok_locator).click()

    #断言修改成功
    def amend_ok(self):
        return self.driver.find_element(*self.amend_locator).text




